<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <button @click="add">add</button>
        <button @click="remove">remove</button>
        <ul>
            <li v-for="(item,index) in arr">
                {{index}}--{{item}}
            </li>
        </ul>
        <h2 v-for="(item,index) in objArr" v-bind:title="item.name">
            {{index}}--{{item.name}}
        </h2>
    </div>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                arr:["北京","上海","广州","深圳"],
                objArr:[
                    {name:"jack"},
                    {name:"rose"}
                ]
            },
            methods:{
                add:function(){
                    this.objArr.push({name:"tom"});
                },
                remove:function(){
                    this.objArr.shift();
                },
            }
        })
    </script>
</body>
</html>